package com.sunday.common.validation.annotation;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;


@Slf4j
public class OpenDistributedLockValidator implements ConstraintValidator<OpenDistributedLock, Object> {

    private OpenDistributedLock openDistributedLock;

    public void initialize(OpenDistributedLock openDistributedLock) {
        this.openDistributedLock = openDistributedLock;
    }

    @Override
    public boolean isValid(Object value, ConstraintValidatorContext context) {
        log.info("{}", value);
        if (ObjectUtils.isEmpty(value)) {
            return true;
        }
        return false;
    }

}
